--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit faa79db224bd6b41d67a3e65c3d4046e041cfe11
Parents : 85c8fbc
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-25T17:03:38+01:00
Load filterlib as static dll on windows
Changes
2 files changed, 10 insertions(+), 10 deletions(-)
Diff
diff --git a/LXST/Filters.py b/LXST/Filters.py
index 19804ef..c08ec95 100644
--- a/LXST/Filters.py
+++ b/LXST/Filters.py
@@ -16,15 +16,16 @@ else:
ffi = FFI()
try:
- # Disable native filterlib loading on Windows
- # for now due to strange linking behaviour,
- # but allow local compilation if the user has
- # a C compiler installed.
- filterlib_spec = find_spec("LXST.filterlib")
- if not filterlib_spec or filterlib_spec.origin == None: raise ImportError("Could not locate pre-compiled LXST.filterlib module")
- with open(os.path.join(c_src_path, "Filters.h"), "r") as f: ffi.cdef(f.read())
- native_functions = ffi.dlopen(filterlib_spec.origin)
- USE_NATIVE_FILTERS = True
+ if not RNS.vendor.platformutils.is_windows():
+ filterlib_spec = find_spec("LXST.filterlib")
+ if not filterlib_spec or filterlib_spec.origin == None: raise ImportError("Could not locate pre-compiled LXST.filterlib module")
+ with open(os.path.join(c_src_path, "Filters.h"), "r") as f: ffi.cdef(f.read())
+ native_functions = ffi.dlopen(filterlib_spec.origin)
+ USE_NATIVE_FILTERS = True
+ else:
+ with open(os.path.join(c_src_path, "Filters.h"), "r") as f: ffi.cdef(f.read())
+ native_functions = ffi.dlopen(os.path.join(c_src_path, "filterlib.dll"))
+ USE_NATIVE_FILTERS = True
except Exception as e:
RNS.log(f"Could not load pre-compiled LXST filters library. The contained exception was: {e}", RNS.LOG_WARNING)
diff --git a/LXST/Platforms/windows.c b/LXST/Platforms/windows.c
deleted file mode 100644
index 7efb938..0000000
--- a/LXST/Platforms/windows.c
+++ /dev/null
@@ -1 +0,0 @@
-void PyInit_filterlib(void) { }
\ No newline at end of file
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────